<?php

class Pictures_Image_DeleteSuccessView extends BlogPicturesBaseView
{
	public function executeHtml(AgaviRequestDataHolder $rd)
	{
		if (!is_null($this->getAttribute('ok'))) {
		    // redirect back to the list
		    $this->setRoutingRedirect('pic.list');
		    return;
		}
		
		// display confirmation form
		$params = $rd->getParameters();
		$pic_id = $params['pic_id'];
		$ro = $this->getContext()->getRouting();
		
		$this->setupHtml($rd, 'blog');
		
		/* @var $model Pictures_PicturesModel */
		$model = $this->getContext()->getModel('Pictures', 'Pictures');
		
		$picture = $model->getPicture($pic_id);
		
		$this->setAttribute('image_name', $picture->name);
		$this->setAttribute('submit_route', $ro->gen('pic.delete', array('pic_id'=>$pic_id)));
		$this->setAttribute('title', 'Delete picture');
	}
}

?>
